home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 9
/
PC World Interactive 9 - Temmuz 1998.iso
/
share
/
internet
/
hot
/
cgi.z
/
rand_lnk.pl
< prev
next >
Wrap
Perl Script
|
1997-06-20
|
965b
|
35 lines
#! /bin/perl
##############################################################################
# Random Link Generator
# Created By Matt Wright
# Version 1.0
# Created on 7/15/95 Last Modified On 7/30/95
# I can be reached at: mattw@misha.net
# Scripts Found at: http://worldwidemart.com/scripts/
# The file README contains more information and installation instructions.
# Define Variables
$linkfile = "/home/youruserid/public_html/database";
# Options
$uselog = 0; # 1 = YES; 0 = NO
$logfile = "/home/youruserid/public_html/rand_log";
$date = `date +"%D"`; chop($date);
open (LINKS, "$linkfile");
srand(); # kick rand
$nlines=@file=<LINKS>; # inhale file & get # of lines
print "Location: $file[int rand $nlines]\n\n"; # print a random line
close (LINKS);
if ($uselog eq '1') {
open (LOG, ">>$logfile");
print LOG "$ENV{'REMOTE_HOST'} - [$date]\n";
close (LOG);
}
exit;